﻿<navigation:Page x:Class="SD.Samples.Views.Samples" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:SD.Samples.Views"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    d:DesignWidth="640" d:DesignHeight="300" mc:Ignorable="d"
    Style="{StaticResource PageStyle}" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    
    <navigation:Page.Resources>
        <local:SourceFileContentConverter x:Key="SourceFileContentConverter" />
    </navigation:Page.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
                
        <TextBlock Grid.Row="0" FontSize="16" TextWrapping="Wrap" Foreground="{StaticResource BaseBrush4}" Text="{Binding SampleName}" Margin="0,10,0,0"/>
        <TextBlock Grid.Row="1" FontSize="16" TextWrapping="Wrap" Foreground="{StaticResource BaseBrush5}" Text="{Binding SampleDescription}"  HorizontalAlignment="Left" Margin="0,3,0,0"/>
        
        <StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,4,0,4">
            <TextBlock Text="Read the" />
            <HyperlinkButton FontSize="14" Foreground="{StaticResource HighLightColorBrush}" TargetName="_blank" VerticalAlignment="Bottom" Margin="2,0,2,0" Content="documentation" NavigateUri="{Binding SamplePage}" />
            <TextBlock Text="of this sample or" />
            <HyperlinkButton FontSize="14" Foreground="{StaticResource HighLightColorBrush}" TargetName="_blank" VerticalAlignment="Bottom" Margin="2,0,2,0" Content="download" NavigateUri="http://silverdiagram.codeplex.com/SourceControl/list/changesets" />
            <TextBlock Text="the source of this application." />
        </StackPanel>
        
        <sdk:TabControl Grid.Row="3" VerticalAlignment="Stretch" Margin="0,10,0,0" >
            <sdk:TabItem Header="Sample" Background="White">
                <Grid Margin="4">
                    <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
                        <local:LoadingIndicator Grid.Row="2" />

                        <TextBlock Foreground="{StaticResource BaseBrush5}" Text="Loading Silverdiagram Sample" HorizontalAlignment="Center" Margin="4" />
                    </StackPanel>

                    <ContentControl VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" Content="{Binding Sample}" />
                </Grid>
            </sdk:TabItem>
            <sdk:TabItem Header="Source Files">
                <Grid Margin="4">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock Foreground="{StaticResource BaseBrush4}" Margin="5,0,0,4" Text="Select one of the source files below to see the source of the current example:" />
                    
                    <sdk:TabControl Grid.Row="1" ItemsSource="{Binding SourceFiles, Converter={StaticResource SourceFileContentConverter}}" />
                </Grid>
            </sdk:TabItem>
        </sdk:TabControl>
    </Grid>
</navigation:Page>
